<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>[Generic Component Framework v3] GCF::IpcServerDiscovery Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<!--link href="tabs.css" rel="stylesheet" type="text/css"-->
</head><body>
 <div id="wrapper">
    <div id="logo_box">
        <a class="img_link" href="https://github.com/pnudupa/gcf" target="_blank" ><img style="float:left;margin-left:10px;margin-top:5px;margin-bottom:5px;"src="header_gcf_logo.jpg" alt="GCF LOGO"/></a>
        <a class="img_link" href="https://www.vcreatelogic.com/" target="_blank" ><img style="float:right;margin-right:10px; margin-top: 30px;" src="header_vcl_logo.jpg" alt="VCL LOGO"/></a>
        <div style="clear:both"></div>
    </div>
    <div class="nav">
        <ul>
            <li class="selectedpage">
                <a class="a-home" href="index.html" >
                    <span>Home</span>
                </a>
            </li>
            <li>
                <a class="a-classes " href="classes.html">
                    <span>All Classes</span>
                </a>
            </li>
            <li>
                <a class="a-home " href="gcf_modules.html">
                    <span>Modules</span>
                </a>
            </li>
            <li>
                <a class="a-home " href="gcf_guides_and_videos.html">
                    <span>Guides & Videos</span>
                </a>
            </li>
            <li>
                <a class="a-home " href="gcf_tools_and_inbuilt_components.html">
                    <span>Tools & Components</span>
                </a>
            </li>
        </ul>
    </div>
    <div id="main-content">
        <div class="inside">
        <div>
<!-- Generated by Doxygen 1.8.16 -->
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><b>GCF</b></li><li class="navelem"><a class="el" href="class_g_c_f_1_1_ipc_server_discovery.html">IpcServerDiscovery</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#signals">Signals</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="class_g_c_f_1_1_ipc_server_discovery-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">GCF::IpcServerDiscovery Class Reference<div class="ingroups"><a class="el" href="group__gcf__ipc.html">IPC module in GCF</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p>This class can be used to discover <a class="el" href="class_g_c_f_1_1_ipc_server.html" title="Provides a IPC server based on QTcpServer.">GCF::IpcServer</a> instances on LAN.  
 <a href="class_g_c_f_1_1_ipc_server_discovery.html#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="signals"></a>
Signals</h2></td></tr>
<tr class="memitem:ad28400356db908127ad7b44d19189130"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_g_c_f_1_1_ipc_server_discovery.html#ad28400356db908127ad7b44d19189130">foundServer</a> (const <a class="el" href="struct_g_c_f_1_1_ipc_server_info.html">GCF::IpcServerInfo</a> &amp;info)</td></tr>
<tr class="separator:ad28400356db908127ad7b44d19189130"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a76019e7cb3978c9810855f23ef91c3f0"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_g_c_f_1_1_ipc_server_discovery.html#a76019e7cb3978c9810855f23ef91c3f0">IpcServerDiscovery</a> (QObject *parent=0)</td></tr>
<tr class="separator:a76019e7cb3978c9810855f23ef91c3f0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3c8cf1e3b276fd8999cf83be045df335"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_g_c_f_1_1_ipc_server_discovery.html#a3c8cf1e3b276fd8999cf83be045df335">~IpcServerDiscovery</a> ()</td></tr>
<tr class="separator:a3c8cf1e3b276fd8999cf83be045df335"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0f0a113185af3348a74975ddb50f3faa"><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_g_c_f_1_1_result.html">GCF::Result</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_g_c_f_1_1_ipc_server_discovery.html#a0f0a113185af3348a74975ddb50f3faa">start</a> (quint16 port=0)</td></tr>
<tr class="separator:a0f0a113185af3348a74975ddb50f3faa"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abfd72e2e4c0c946436a8f0249621279e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_g_c_f_1_1_result.html">GCF::Result</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_g_c_f_1_1_ipc_server_discovery.html#abfd72e2e4c0c946436a8f0249621279e">stop</a> ()</td></tr>
<tr class="separator:abfd72e2e4c0c946436a8f0249621279e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af2c6a7cac37c1830bce40b67d3cfc235"><td class="memItemLeft" align="right" valign="top">QList&lt; <a class="el" href="struct_g_c_f_1_1_ipc_server_info.html">GCF::IpcServerInfo</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_g_c_f_1_1_ipc_server_discovery.html#af2c6a7cac37c1830bce40b67d3cfc235">foundServers</a> () const</td></tr>
<tr class="separator:af2c6a7cac37c1830bce40b67d3cfc235"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6aec69b4a04a292672bc62bc9f95b8e1"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_g_c_f_1_1_ipc_server_discovery.html#a6aec69b4a04a292672bc62bc9f95b8e1">releaseFoundServer</a> (const <a class="el" href="struct_g_c_f_1_1_ipc_server_info.html">GCF::IpcServerInfo</a> &amp;info)</td></tr>
<tr class="separator:a6aec69b4a04a292672bc62bc9f95b8e1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aef380ce8ce6328e582ab80062b2d4457"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_g_c_f_1_1_ipc_server_discovery.html#aef380ce8ce6328e582ab80062b2d4457">releaseAllFoundServers</a> ()</td></tr>
<tr class="separator:aef380ce8ce6328e582ab80062b2d4457"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:a0fdccda4902908529c7b0e34d769ce37"><td class="memItemLeft" align="right" valign="top">static QString&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_g_c_f_1_1_ipc_server_discovery.html#a0fdccda4902908529c7b0e34d769ce37">user</a> ()</td></tr>
<tr class="separator:a0fdccda4902908529c7b0e34d769ce37"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>You can create an instance of this class in your application and invoke the <a class="el" href="class_g_c_f_1_1_ipc_server_discovery.html#a0f0a113185af3348a74975ddb50f3faa">start()</a> method to begin looking for <a class="el" href="class_g_c_f_1_1_ipc_server.html" title="Provides a IPC server based on QTcpServer.">GCF::IpcServer</a> instances in other applications on the LAN that are open and listening. Everytime such a server is found, this class emits a <a class="el" href="class_g_c_f_1_1_ipc_server_discovery.html#ad28400356db908127ad7b44d19189130">foundServer()</a> signal. You can get a list of all found servers by calling <a class="el" href="class_g_c_f_1_1_ipc_server_discovery.html#af2c6a7cac37c1830bce40b67d3cfc235">foundServers()</a>. Once the <a class="el" href="class_g_c_f_1_1_ipc_server_discovery.html#ad28400356db908127ad7b44d19189130">foundServer()</a> signal is emitted for a particular server, it wont be emitted again for the same server. You can force the emission by removing the server from the list of found servers using the <a class="el" href="class_g_c_f_1_1_ipc_server_discovery.html#a6aec69b4a04a292672bc62bc9f95b8e1">releaseFoundServer()</a> method. Of release information about all found servers by calling the <a class="el" href="class_g_c_f_1_1_ipc_server_discovery.html#aef380ce8ce6328e582ab80062b2d4457">releaseAllFoundServers()</a> method.</p>
<dl class="section note"><dt>Note</dt><dd>You can only discover <a class="el" href="class_g_c_f_1_1_ipc_server.html" title="Provides a IPC server based on QTcpServer.">GCF::IpcServer</a> instances in those applications that also have an instance of this class <a class="el" href="class_g_c_f_1_1_ipc_server_discovery.html#a0f0a113185af3348a74975ddb50f3faa">started</a> on the same port. </dd></dl>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a76019e7cb3978c9810855f23ef91c3f0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a76019e7cb3978c9810855f23ef91c3f0">&#9670;&nbsp;</a></span>IpcServerDiscovery()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">GCF::IpcServerDiscovery::IpcServerDiscovery </td>
          <td>(</td>
          <td class="paramtype">QObject *&#160;</td>
          <td class="paramname"><em>parent</em> = <code>0</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Constructor.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">parent</td><td>a <code>QObject</code> parent to which this object will become a child </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a3c8cf1e3b276fd8999cf83be045df335"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3c8cf1e3b276fd8999cf83be045df335">&#9670;&nbsp;</a></span>~IpcServerDiscovery()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">GCF::IpcServerDiscovery::~IpcServerDiscovery </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Destructor. Stops discovery before destroying itself. </p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a0fdccda4902908529c7b0e34d769ce37"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0fdccda4902908529c7b0e34d769ce37">&#9670;&nbsp;</a></span>user()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">QString GCF::IpcServerDiscovery::user </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<dl class="section return"><dt>Returns</dt><dd>user-name of this computer that will be broadcasted to other applications. </dd></dl>

</div>
</div>
<a id="a0f0a113185af3348a74975ddb50f3faa"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0f0a113185af3348a74975ddb50f3faa">&#9670;&nbsp;</a></span>start()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="class_g_c_f_1_1_result.html">GCF::Result</a> GCF::IpcServerDiscovery::start </td>
          <td>(</td>
          <td class="paramtype">quint16&#160;</td>
          <td class="paramname"><em>port</em> = <code>0</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This function starts the discovery process. It does two things</p>
<ul>
<li>Opens a UDP socket on the given <code>port</code> </li>
<li>Once in every 2 seconds, it broadcasts information about all <a class="el" href="class_g_c_f_1_1_ipc_server.html" title="Provides a IPC server based on QTcpServer.">GCF::IpcServer</a> instances in this application. </li>
<li>Begins listening for broadcast information packets sent by instances of this class in other applications opened on the same port. </li>
</ul>

</div>
</div>
<a id="abfd72e2e4c0c946436a8f0249621279e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abfd72e2e4c0c946436a8f0249621279e">&#9670;&nbsp;</a></span>stop()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="class_g_c_f_1_1_result.html">GCF::Result</a> GCF::IpcServerDiscovery::stop </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Stops discovering <a class="el" href="class_g_c_f_1_1_ipc_server.html" title="Provides a IPC server based on QTcpServer.">GCF::IpcServer</a> instances and also stops broadcasting informtion about <a class="el" href="class_g_c_f_1_1_ipc_server.html" title="Provides a IPC server based on QTcpServer.">GCF::IpcServer</a> instances in this application. </p>

</div>
</div>
<a id="af2c6a7cac37c1830bce40b67d3cfc235"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af2c6a7cac37c1830bce40b67d3cfc235">&#9670;&nbsp;</a></span>foundServers()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">QList&lt; <a class="el" href="struct_g_c_f_1_1_ipc_server_info.html">GCF::IpcServerInfo</a> &gt; GCF::IpcServerDiscovery::foundServers </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="section return"><dt>Returns</dt><dd>a list of found servers </dd></dl>

</div>
</div>
<a id="a6aec69b4a04a292672bc62bc9f95b8e1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6aec69b4a04a292672bc62bc9f95b8e1">&#9670;&nbsp;</a></span>releaseFoundServer()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void GCF::IpcServerDiscovery::releaseFoundServer </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="struct_g_c_f_1_1_ipc_server_info.html">GCF::IpcServerInfo</a> &amp;&#160;</td>
          <td class="paramname"><em>info</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Removes server-info (<code>info</code> ) from the list of found servers. </p>

</div>
</div>
<a id="aef380ce8ce6328e582ab80062b2d4457"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aef380ce8ce6328e582ab80062b2d4457">&#9670;&nbsp;</a></span>releaseAllFoundServers()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void GCF::IpcServerDiscovery::releaseAllFoundServers </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Removes all found server information. </p>

</div>
</div>
<a id="ad28400356db908127ad7b44d19189130"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad28400356db908127ad7b44d19189130">&#9670;&nbsp;</a></span>foundServer</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void GCF::IpcServerDiscovery::foundServer </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="struct_g_c_f_1_1_ipc_server_info.html">GCF::IpcServerInfo</a> &amp;&#160;</td>
          <td class="paramname"><em>info</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">signal</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>This signal is emitted whenever this class detects the existence of a <a class="el" href="class_g_c_f_1_1_ipc_server.html">GCF::IpcServer</a> on the LAN. </p>

</div>
</div>
</div><!-- contents -->
</div>
</div>
</div>
<div class="footer_content">
<table width="100%" class="footer">
<tr>
<td align="left" width="50%">Copyright &copy; 2013-2019,
 <a class="el" href="http://www.vcreatelogic.com" target="_black">VCreate Logic Private Limited</a></td>
<td align="right" width="50%"><a class="el" href="http://www.vcreatelogic.com/products/gcf" target="_black">GCF - Generic Component Framework</a></td>
</tr>
</table>
</div>
</div>
</body>
</html>
